//
//  OECollectionTableViewCell.m
//  OneEightyNine
//
//  Created by Mac on 2019/3/5.
//  Copyright © 2019 stoneobs. All rights reserved.
//

#import "OECollectionTableViewCell.h"

@interface  OECollectionTableViewCell()
@property(nonatomic, strong) UIImageView                     *iconImagView;/**<  */
@property(nonatomic, strong) STLabel                     *nameLable;/**<  */
@property(nonatomic, strong) STLabel                     *numLable;/**<  */
@end
@implementation OECollectionTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if (self == [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self configSubView];
    }
    return self;
}
+ (CGFloat)cellHeight{
    return 70;
}
#pragma mark --subView
- (void)configSubView{
    UIImageView * imageView = [[UIImageView alloc] initWithFrame:CGRectMake(10, 10, 50, 50)];
    imageView.image = [UIImage imageNamed:@""];
    [self addSubview:imageView];
    self.iconImagView = imageView;

    self.nameLable = [[STLabel alloc] initWithFrame:CGRectMake(imageView.right + 10, imageView.top,
                                                                     UIScreenWidth - imageView.right-20, 25)
                                                     text:@""
                                                textColor:FirstTextColor
                                                     font:15
                                              isSizetoFit:NO
                                            textAlignment:NSTextAlignmentLeft];
    [self addSubview:self.nameLable];
    
    self.numLable = [[STLabel alloc] initWithFrame:CGRectMake(imageView.right + 10, self.nameLable.bottom,
                                                               UIScreenWidth - imageView.right-20, 25)
                                               text:@""
                                          textColor:SecendTextColor
                                               font:13
                                        isSizetoFit:NO
                                      textAlignment:NSTextAlignmentLeft];
    [self addSubview:self.numLable];
    [self.iconImagView st_setBorderWith:0.5 borderColor:TM_lineColor cornerRadius:2];
}
- (void)setModel:(OECollectionModel *)model{
    _model = model;
    [self.iconImagView sd_setImageWithURL:[NSURL URLWithString:model.supplier_logo]];
    
    self.nameLable.text = model.supplier_name;
    self.numLable.text = [NSString stringWithFormat:@"%@ %@",model.fans_count,@"Collecton"];
    self.numLable.attributedText  =  [self.numLable.text st_convertAttributeStringWithKeyWord:model.fans_count attributes:@{NSForegroundColorAttributeName:OE_LIMITE_COLOR}];
}
@end
